local opts = { noremap = true, silent = false}
vim.api.nvim_set_keymap("n", "sv", ":vs<CR>", opts)
vim.api.nvim_set_keymap("n", "sp", ":sp<CR>", opts)
vim.api.nvim_set_keymap("n", "sl", "<c-w><c-l>", opts)
vim.api.nvim_set_keymap("n", "sh", "<c-w><c-h>", opts)
vim.api.nvim_set_keymap("n", "sj", "<c-w><c-j>", opts)
vim.api.nvim_set_keymap("n", "sk", "<c-w><c-k>", opts)

vim.api.nvim_set_keymap("i", "jk", "<ESC>", opts)

vim.api.nvim_set_keymap("n", "w", ":w<CR>", opts)
vim.api.nvim_set_keymap("n", "q", ":q<CR>", opts)

vim.api.nvim_set_keymap("n", "tn", ":tabnew<CR>", opts)
vim.api.nvim_set_keymap("n", "tl", ":BufferLineCycleNext<CR>", opts)
vim.api.nvim_set_keymap("n", "th", ":BufferLineCyclePrev<CR>", opts)
vim.api.nvim_set_keymap("n", "tb", ":BufferLinePick<CR>", opts)
vim.api.nvim_set_keymap("n", "te", ":terminal<CR>", opts)
vim.api.nvim_set_keymap("n", "tt", ":NvimTreeToggle<CR>", opts)

vim.api.nvim_set_keymap("n", "pi", ":PackerInstall<CR>", opts)
vim.api.nvim_set_keymap("n", "pc", ":PackerCompile<CR>", opts)
vim.api.nvim_set_keymap("n", "pcc", ":PackerClean<CR>", opts)
vim.api.nvim_set_keymap("n", "pu", ":PackerUpdate<CR>", opts)
vim.api.nvim_set_keymap("n", "ps", ":PackerSync<CR>", opts)

vim.api.nvim_set_keymap("n", "fa", ":Clap blines<CR>", opts)
vim.api.nvim_set_keymap("n", "fh", ":Clap history<CR>", opts)
vim.api.nvim_set_keymap("n", "ff", ":Clap files<CR>", opts)
vim.api.nvim_set_keymap("n", "fb", ":Clap marks<CR>", opts)
vim.api.nvim_set_keymap("n", "fc", ":Clap colors<CR>", opts)



vim.api.nvim_set_keymap("n", "ci", ":CocInstall coc-rust-analyzer coc-cmake coc-pyright coc-clangd coc-java<CR>", opts)
vim.api.nvim_set_keymap("n", "cu", ":CocUpdate<CR>", opts)
vim.api.nvim_set_keymap("n", "cc", ":CocList<CR>", opts)

vim.api.nvim_set_keymap("n", "e", ":Vista<CR>", opts)

vim.cmd([[
inoremap <silent><expr> <TAB>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>

function! ShowDocumentation()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    call feedkeys('K', 'in')
  endif
endfunction
]])